<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<?php echo $this->Facebook->html();?>
<head>
	<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
	<meta http-equiv="X-UA-Compatible" content="IE=8;" />  
	<title>
		<?php  echo $title_for_layout; ?>
	</title>
	<meta name="title" content="<?php  echo $meta_title;?>" />
	<meta name="keywords" content="<?php  echo $meta_keywords;?>"/>
	<meta name="description" content="<?php  echo $meta_description;?>"/>
	<?php 
		echo $this->Html->css('style');
		echo $this->Html->css('home');
		echo $this->Html->css('menu');
	?>
	<!--[if IE 6]>
	<?php //echo $this->Html->script('DD_belatedPNG_0.0.8a-min'); ?>
	<script type="text/javascript">//DD_belatedPNG.fix('.tips_menu,.tips_top,.tips_content,.tips_btm,.tips_HomeActive,.tips_shareActive,.tips_tipsActive,.tips_userActive,.tips_ascottsActive,.tips_inviteActive');</script>
	<![endif]-->
	<!--[if lt IE 7]>
         <script type="text/javascript" src="/js/unitpngfix.js"></script>
	<![endif]-->  

	<script type="text/javascript">
		var webroot = "<?=@$this->webroot; ?>";
		var APP_URL = "<?=@APP_URL?>"; 
		var server = "<?='http://' . env('SERVER_NAME')?>";
		var here = "<?=@$this->here;?>";
		var display_mode = "<?=@display_mode?>";

		
		
	</script>

	<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.5.0/jquery.min.js"></script>
	<?php 	
		// echo $this->Html->script('jquery/jquery.slide');  
		echo $this->Html->script('fckeditor'); 
	
	?>
	
	<script type="text/javascript">

		var _gaq = _gaq || [];
		_gaq.push(['_setAccount', '<?=GA_ID?>']);
		_gaq.push(['_trackPageview']);

		(function() {
			var ga = document.createElement('script'); ga.type = 'text/javascript'; ga.async = true;
			ga.src = ('https:' == document.location.protocol ? 'https://ssl' : 'http://www') + '.google-analytics.com/ga.js';
			var s = document.getElementsByTagName('script')[0]; s.parentNode.insertBefore(ga, s);
		})();

	</script>
	<?
		if (isset($bodyAttr)) {
			$bodyAttr = " $bodyAttr";
		} else {
			$bodyAttr = null;
		}
	?>

<!--[if lte IE 6]>
<? echo $this->Html->script('ie6/warning.js');  ?>
<script>window.onload=function(){IE6WarningPopup("./js/ie6/");IE6WarningBar();}</script>
<![endif]--> 

</head>

<body>
	<div style='display:none'><?php echo $this->Session->flash(); ?></div>	
	<div class="wrapper" id="wrapper">
		<div class="header">
			<div class="topBar">
				<?
				if($user || $facebook_user)
				{
					if($facebook_user):
						?>
							<span>Welcome <?=$session->read('Auth.User.name')?></span>
						<?
						echo $html->link('<span class="btnBg">Edit Profile</span>','/users/profile',array('class'=>'btn btnBrown01', 'escape'=>false));
						echo $facebook->logout(array('redirect'=>'/users/logout', 'custome'=>true, 'class'=>'fb_button fb_button_medium', 'label'=>'Facebook Logout', 'escape'=>false));
					else:
						?>
							<span>Welcome <?=$session->read('Auth.User.name')?></span>
						<?
						echo $html->link('<span class="btnBg">Edit Profile</span>','/users/profile',array('class'=>'btn btnBrown01', 'escape'=>false));
						echo $html->link('<span class="btnBg">Logout</span>','/users/logout',array('class'=>'btn btnBrown01', 'escape'=>false));
					endif;
				}
				else
				{
					echo $facebook->login(array(
						'perms' => 'email',
					)
		);
					echo $html->link('<span class="btnBg">Login</span>','/users/login',array('class'=>'btn btnBrown01', 'escape'=>false));
					echo $html->link('<span class="btnBg">Register</span>','/users/register',array('class'=>'btn btnBrown01', 'escape'=>false));
					
				}
				?>
			</div>
			<ul class="menu">
				<?
				$active = 0;
				switch($this->name)
				{	
					case 'Products':
						switch($this->params['url']['url'])
						{
							case 'index':
								$active = 1;	
								break;
							case 'testimonies':
								$active = 2;
								break;	
							case 'ibless/map':
								$active = 5;
								break;						
							default:
								$active = 1;
								break;	
						}
						break;
						
					case 'Pages':
						$active = 4;	
						break;
						
					default:
						$active=0;
				}	
				?>
			
				<li <?if($active == 1) echo 'class="active"'?>><a href="<?=$this->webroot?>" class="home"></a></li>
				<li <?if($active == 5) echo 'class="active"'?>><a href="<?=$this->webroot.'ibless/map'?>" class="map"></a></li>
				<li <?if($active == 2) echo 'class="active"'?>><a href="<?=$this->webroot.'testimonies'?>" class="testimonies"></a></li>
				<li <?if($active == 4) echo 'class="active"'?>><a href="<?=$this->webroot.'about'?>" class="up40"></a></li>
			</ul>
			<?=$html->link($html->image('logo.png', array('alt'=>'40UP')),'/', array('class'=>'left', 'escape'=>false)) ?>
		</div>
		
		<?
			echo $this->Form->create('Product', array('action' => 'search'));
			echo $this->Form->input('keyword', array('div'=>false, 'label'=>false, 'style'=>'float:left'));
		?>
		<div class="btnYellow01 marginRight10" style="float:left">
			<input class="btn cursor_pointer" type="submit" value="Search">
		</div>
		<?
			echo $this->Form->end();
		?>
		<div class="content">
			
		<!-- START OF CONTENT -->
					
					<?php 
						echo $content_for_layout; 
					?>
			
		<!-- END OF CONTENT -->
		<?
			if(($this->here != $this->webroot.'tnc')&&($this->here != $this->webroot.'users/login') && ($this->here != $this->webroot.'users/register'))
				echo $this->element('right_box') ;	
		?>
			
		</div>
		<div class="footer">
			Copyright&copy; 2011 Faith Community Baptist Church. All rights reserved.
			
			<span class="right">
			<a href="<?=$this->webroot?>">Home</a>  |  <a href="<?=$this->webroot.'ibless/map'?>">Map</a>  |  <a href="<?=$this->webroot.'testimonies'?>">Testimonies</a>  |  <a href="<?=$this->webroot.'about'?>">About 40UP</a> | <a href="<?=$this->webroot.'tnc'?>">Terms of use</a> 
			
			<?if($user&&$user['User']['role']==ADMIN):?>
			| <a href="<?=$this->webroot.'admin/users/member'?>">Admin</a>
			<?endif;?>
			<a href="#wrapper" class="btnUp">Top</a>  
			</span>
		</div>	
	</div>
	<?php echo $this->element('sql_dump'); ?>
	<?php echo $this->Facebook->init(array('redirect' => '/users/profile'));?>
</body>
</html>
